﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true"
    CodeBehind="ServiceManagement.aspx.cs" Inherits="VSM.ServiceManagement" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script type="text/javascript">
        function openMultiItemDialog() {
            var tabid = '<%= Request.QueryString["requestType"] %> ';
            javascript: Main.openCustomDialog('../../ItemPopup.aspx?ItemCategory=' + '102', 600, 610, "");
        }

        function openCustomer() {
            var url = "Popup_Customer.aspx?CustomerCode=S";
            Main.openCustomDialog(url, 650, 410);
        }

        function openVehicle() {
            var url = "Popup_Vehice.aspx?VehicleCode=S";
            Main.openCustomDialog(url, 650, 410);
        }

        function disablePopup(sender, evt) {

            var charCode = (evt.which) ? evt.which : event.keyCode;
            if (charCode == 13)
                return true;

            return true;
        }

        function loadQuotationReport() {
            var url = "rptQuotation.aspx?QuotationCode=S";
            Main.openCustomDialog(url, 650, 410);
        }

        function openAP() {
            window.location.href= "AppointmentSheet.aspx";
        }

        function openPopup(type) {
            var url = "rptViewer.aspx?type=" + type;
            Main.openCustomDialog(url, 950, 700);
        }

        function openServiceDetail(gID) {
            window.location.href = "ServiceRequest.aspx?ServiceID=" + gID;
        }
    </script>
    <div>
        <asp:UpdatePanel ID="updatePanel" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <asp:HiddenField ID="DealerCode" runat="server" />
                <h2>
                    Service History</h2>
                <div style="margin-left: 5px; width: 99%;">
                    <hr />
                   

                      <table border="0" width="100%" style="background-color: #D1D4D8;">
                           <tr>
                                        <td class="FormLineItemAlt" style="width: 8%">
                                            From Date:</td>
                                        <td class="FormLineItemAlt" style="width: 15%">
                                            <asp:TextBox ID="txtFromDate" runat="server" Width="80%"></asp:TextBox>
                                            <asp:ImageButton ID="ImageButton1" runat="Server" AlternateText="Click to show calendar"
                                                ImageUrl="~/Images/Calendar_scheduleHS.png" />
                                            <cc1:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txtFromDate"
                                                PopupButtonID="ImageButton1" Format="dd/MM/yyyy">
                                            </cc1:CalendarExtender>
                                        </td>

                                        <td class="FormLineItemAlt" style="width: 8%">
                                            To Date:</td>
                                        <td class="FormLineItemAlt" style="width: 15%">
                                            <asp:TextBox ID="txt_ToDate" runat="server" Width="80%"></asp:TextBox>
                                            <asp:ImageButton ID="ImageButton2" runat="Server" AlternateText="Click to show calendar"
                                                ImageUrl="~/Images/Calendar_scheduleHS.png" />
                                            <cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txt_ToDate"
                                                PopupButtonID="ImageButton2" Format="dd/MM/yyyy">
                                            </cc1:CalendarExtender>
                                        </td>

                                        <td class="FormLineItemAlt" style="width: 10%">
                                            Adviser:
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 35%">
                                             <asp:DropDownList ID="ddl_Adviser" runat="server" Width="90%">
                                     </asp:DropDownList>
                                </td>
                                    </tr>
                                   
                     </table>


                    <table border="0" width="100%" style="background-color: #D1D4D8;">
                        <tr>
                            <td class="FormLineItemAlt" >
                                <asp:Button ID="btn_Filter" runat="server" BackColor="#1B7FC2" ForeColor="#FFFFFF"
                                    Height="30px" Text="Filter" Width="100px" onclick="btn_Filter_Click" />
                            </td>
                        </tr>
                    </table>

                    <%--<table border="0" width="100%" style="background-color: #D1D4D8;">    CssClass="GridInner"  --%>


                   <%-- </table>--%>
                </div>

                
                    <div style="width: 100%; height: 400px; overflow: scroll">

                   
                    <asp:GridView ID="grvPO" runat="server" BorderColor="White" Width = "1500px"
                            BackColor="White" AllowSorting="True" AutoGenerateColumns="False" CellPadding="2"
                            HeaderStyle-Height="27px" CellSpacing="2" 
                            HeaderStyle-VerticalAlign="Middle" 
                            AllowPaging="True">
                            <PagerSettings Mode="NumericFirstLast" />
                            <PagerStyle BackColor="#70A0D0" Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle" />
                            <RowStyle BackColor="#D9E0ED" BorderColor="White" BorderWidth="2px" Height="25px" />
                            <AlternatingRowStyle BackColor="#EEF1F7" BorderColor="White" BorderWidth="2px" />
                            <Columns>

                                <asp:TemplateField HeaderText="Action">
                                    <ItemStyle HorizontalAlign="Center"  Width="70px" />
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemTemplate>
                                        <asp:Button ID="btnDetail" runat="server" Text="Detail" Width="60px"  BackColor="#1B7FC2" ForeColor="#FFFFFF" OnClientClick='<%#"openServiceDetail(\"" +Eval("GeneralID") +"\");" %>'/>
                                          
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="#">
                                    <ItemStyle HorizontalAlign="Center" Width="20px" />
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblNo" runat="server" Text='<%# Bind("RowNum") %>' BorderStyle="none">
                                        </asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="G ID">
                                    <ItemStyle HorizontalAlign="Center" Width="30px" />
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblGeneralID" runat="server" Text='<%# Bind("GeneralID") %>' BorderStyle="none" ClientIDMode="Static">
                                        </asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Service Date">
                                    <ItemStyle HorizontalAlign="Left" Width="70px" />
                                    <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                    <ItemTemplate>
                                        <asp:Label ID="lbDateIn" runat="server" Text='<%# Bind("ServiceDate","{0:dd/MM/yyyy}") %>' ></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Job ID">
                                    <ItemStyle HorizontalAlign="Left" Width="70px" />
                                    <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                    <ItemTemplate>
                                        <asp:Label ID="lbJobID" runat="server" Text='<%# Bind("JobID") %>' ></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                 <asp:TemplateField HeaderText="Job Kind">
                                    <ItemStyle HorizontalAlign="Left" Width="140px" />
                                    <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                    <ItemTemplate>
                                        <asp:Label ID="lbJobKind" runat="server" Text='<%# Bind("JobKind") %>' ></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Receptionist">
                                    <ItemStyle HorizontalAlign="Left" Width="140px" />
                                    <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                    <ItemTemplate>
                                        <asp:Label ID="lbReceptionist" runat="server" Text='<%# Bind("Receptionist") %>' ></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Adviser">
                                    <ItemStyle HorizontalAlign="Left" Width="140px" />
                                    <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                    <ItemTemplate>
                                        <asp:Label ID="lbAdviser" runat="server" Text='<%# Bind("AdviserName") %>' ></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                 <asp:TemplateField HeaderText="Technician">
                                    <ItemStyle HorizontalAlign="Left" Width="140px" />
                                    <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                    <ItemTemplate>
                                        <asp:Label ID="lbTechnician" runat="server" Text='<%# Bind("TechnicianName") %>' ></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Date In">
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Center" Width="100px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lbDateIn" runat="server" Width="97%" Text='<%# Bind("DateIn","{0:dd/MM/yyyy}") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Date Out">
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Center" Width="100px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lbDateOut" runat="server" Width="97%" Text='<%# Bind("ActualDelivery","{0:dd/MM/yyyy}") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>

                                 <asp:TemplateField HeaderText="Odometer">
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Center" Width="100px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lbOdometer" runat="server" Width="97%" Text='<%# Bind("Odometer") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>

                                 <asp:TemplateField HeaderText="Request">
                                    <ItemStyle HorizontalAlign="Left" />
                                    <HeaderStyle VerticalAlign="Middle" Width="200px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lbCustomerRequest" Style="text-align: left" runat="server" Text='<%# Bind("CustomerRequest") %>'/>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                
                            </Columns>
                            <HeaderStyle BackColor="#6095C9" Font-Bold="true" ForeColor="#ffffff" Font-Overline="False"
                                Height="27px" VerticalAlign="Bottom" />
                            <EmptyDataTemplate>
                                <table class="GridInner" style="width: 100%; border-color: White;" border="1" rules="all"
                                    cellspacing="2" cellpadding="2">
                                    <tr valign="middle" style="height: 27px; color: white; font-weight: bold; text-decoration: none;
                                        background-color: rgb(96, 149, 201);">
                                        <th>
                                            <span>Action</span>
                                        </th>
                                        <th>
                                            <span>#</span>
                                        </th>
                                         <th>
                                            <span>Service Date</span>
                                        </th>
                                        <th>
                                            <span>Job ID</span>
                                        </th>
                                        <th>
                                            <span>Receptionist</span>
                                        </th>
                                         <th>
                                            <span>Adviser</span>
                                        </th>
                                         <th>
                                            <span>Technician</span>
                                        </th>
                                         <th>
                                            <span>Date In</span>
                                        </th>
                                         <th>
                                            <span>Date out</span>
                                        </th>
                                       <th>
                                            <span>Customer Request</span>
                                        </th>
                                    </tr>
                                    <tr>
                                        <td colspan="10">
                                            <span>No Data</span>
                                        </td>
                                    </tr>
                                </table>
                            </EmptyDataTemplate>
                        </asp:GridView>

                    </div>
                <table width="100%" border="0">
                    <tr>
                        <td>
                            <table style="width: 100%">
                                <tr>
                                    <td style="width: 220px;">
                                      
                                    </td>
                                    <td>
                                        <asp:Label ID="lblError" runat="server" Visible="False" Font-Bold="True" ForeColor="Red"></asp:Label>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
</asp:Content>
